const exceljs = require('exceljs');

async function main() {
  const workbook = new exceljs.Workbook();
  const dataBook = await workbook.xlsx.readFile('/home/kingsome/打金测试-GOLD模式产出金币数据.xlsx');
  dataBook.eachSheet((sheet, sheetIndex) =>{
    //console.log(sheet.name, sheetIndex);
    let data = [];
    if (sheet.name == '打金模式产出金币数据') {
      let idx = 0;
      let isFirstRow = false;
      sheet.eachRow((row, index) => {
        //const name = row.getCell(1).value();
        if (!isFirstRow) {
          isFirstRow = true;
          return;
        }
        const accountId = row.getCell(2).value.toLowerCase();
        const diamond = row.getCell(3).value;
        //console.log(accountId, diamond);
        data.push({
          'idx': ++idx,
          'account_id': accountId,
          'diamond': diamond
        });
      });
    }
    console.log(JSON.stringify(data, "", "  "));
  });
}

main();
